//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.dao.wills;

import com.aidong.dao.base.OrderSet;
import com.aidong.dao.wills.BaseDao;
import com.aidong.model.wills.GcRoom;
import com.aidong.model.wills.GcRoomPK;
import java.util.List;
import org.springframework.stereotype.Repository;

@Repository
public class GcRoomDao extends BaseDao<GcRoom, GcRoomPK> {
	public GcRoomDao() {
	}

	public GcRoom getByCode(String shopCode, String code) {
		return (GcRoom)this.getByWhere("shopCode=:p1 and code=:p2", new Object[]{shopCode, code});
	}

	public boolean chkCodeExists(String shopCode, String code) {
		String sql = "select count(*) from GcRoom where shopCode=:p1 and code=:p2";
		return ((Integer)this.getBySql(Integer.class, sql, new Object[]{shopCode, code})).intValue() > 0;
	}

	public List<GcRoom> getListByShopCode(String shopCode) {
		return this.queryList("shopCode=:p1 and status=1", new Object[]{shopCode}, (new OrderSet()).desc("code"), -1);
	}

	public boolean updateStatus(GcRoom room, int status) {
		String hql = "update GcRoom set status=:p1 where shopCode=:p2 and code=:p3";
		return this.updateByHql(hql, new Object[]{Integer.valueOf(status), room.getShopCode(), room.getCode()}) > 0;
	}
}
